<template>
  <div class="app-container">
    <el-card>
      <template #header>
        <div class="card-header">
          <span>系统设置</span>
        </div>
      </template>
      <div class="system-settings">
        <el-form :model="settingsForm" label-width="120px">
          <el-form-item label="系统名称">
            <el-input v-model="settingsForm.systemName" />
          </el-form-item>
          <el-form-item label="系统版本">
            <el-input v-model="settingsForm.version" disabled />
          </el-form-item>
          <el-form-item label="数据保存天数">
            <el-input-number
              v-model="settingsForm.dataRetentionDays"
              :min="1"
              :max="365"
            />
          </el-form-item>
          <el-form-item label="报警阈值">
            <el-input-number
              v-model="settingsForm.alarmThreshold"
              :min="0"
              :max="100"
            />
          </el-form-item>
          <el-form-item label="自动备份">
            <el-switch v-model="settingsForm.autoBackup" />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="handleSave">保存设置</el-button>
            <el-button @click="handleReset">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
    </el-card>
  </div>
</template>

<script setup>
import { ref } from "vue";

const settingsForm = ref({
  systemName: "能源管理系统",
  version: "v1.0.0",
  dataRetentionDays: 30,
  alarmThreshold: 80,
  autoBackup: true,
});

const handleSave = () => {
  console.log("保存设置", settingsForm.value);
};

const handleReset = () => {
  settingsForm.value = {
    systemName: "能源管理系统",
    version: "v1.0.0",
    dataRetentionDays: 30,
    alarmThreshold: 80,
    autoBackup: true,
  };
};
</script>

<style lang="scss" scoped>
.system-settings {
  padding: 20px;
}
</style>
